import React,{Suspense} from 'react';
import { BrowserRouter,Switch } from 'react-router-dom';
import AuthRoute from './components/AuthRoute';
import { routes } from './routes';

const Router = ()=>{
    return (
        <BrowserRouter>
            <Suspense fallback={'加载中。。。'}>
                <Switch>
                    {
                        routes.map((route,index)=>{
                            return <AuthRoute key={index} {...route} />
                        })
                    }
                </Switch>
            </Suspense>
        </BrowserRouter>
    )
}
export default Router;
